<?php

# ---> summary
$data = $_APP->_CRUD->read('SUM(orderttc) as sum FROM orders 
	WHERE statuspayment=1');
if($data){
	$sumOrders = $data['sum'];
	unset($data);
}

$data = $_APP->_CRUD->read('SUM(orderttc) as sum FROM orders 
	WHERE statuspayment=1 
	AND TO_DAYS(datepayment) = TO_DAYS(NOW())');
if($data){
	$sumOrdersNow = $data['sum'];
	unset($data);
}

$data = $_APP->_CRUD->read('COUNT(id) as count FROM clients WHERE TO_DAYS(NOW()) - TO_DAYS(datecreate) < 30');
if($data){
	$countClients = $data['count'];
	unset($data);
}
# <--- summary

# ---> clients list
$data = $_APP->_CRUD->readById('* FROM clients');
if($data){
	$clients = $data;
	unset($data);
}

$_APP->breadcrumb = '<li><a href="index.php?page=dashboard">Tableau de bord</a></li>';
